package com.example.simpleredis.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.*;

/**
 * @author zhangs
 * @version v1.0
 * @decription 用户实体类
 * @date 2021/4/7 12:00
 **/
@Entity
@Data
@Accessors(chain = true)
// hibernate会给每个被管理的对象加上hibernateLazyInitializer属性
// 下面注解用于告诉jsonPlug组件，在将代理对象转换为json时，忽略value数组中对应的属性
@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler","fieldHandler"})
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(unique = true, length = 100)
    private String username;

    @Column(length = 100)
    private String password;
}
